//
//  SSDetailTopViewCell.m
//  starspaceVR
//
//  Created by 曹端芹 on 17/9/13.
//  Copyright © 2017年 starspace. All rights reserved.
//

#import "SSDetailTopViewCell.h"

#define pictureURL @"http://www.vrspaces.cn"

@interface SSDetailTopViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *iconView;
@property (weak, nonatomic) IBOutlet UILabel *titleL;
@property (weak, nonatomic) IBOutlet UILabel *publishL;
@property (weak, nonatomic) IBOutlet UILabel *compL;
@property (weak, nonatomic) IBOutlet UILabel *versionL;
@property (weak, nonatomic) IBOutlet UILabel *typeL;

@end

@implementation SSDetailTopViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.iconView.layer.cornerRadius = 30.0f;
    self.iconView.clipsToBounds = YES;
}

- (void)setModel:(SSAppliDetailModel *)model {
    _model = model;
    NSString *imageURLString = [NSString stringWithFormat:@"%@%@",pictureURL,model.src];
    [self.iconView sd_setImageWithURL:[NSURL URLWithString:imageURLString] placeholderImage:[UIImage imageNamed:placeholderImageName]];
    self.titleL.text = model.title;
    self.publishL.text = model.publishDateTime;
    self.versionL.text = model.appVersion;
    self.compL.text = model.company;
    
    NSString *typeStr = @"";
    for (int i = 0; i < model.classArray.count; i++) {
        NSDictionary *dict = model.classArray[i];
        NSString  *typeS = dict[@"title"];
        typeStr = [typeStr stringByAppendingFormat:@"%@",typeS];
    }
    
    self.typeL.text = typeStr;
    
}
- (IBAction)downloadBtnClicked:(UIButton *)sender {
    if (self.clickBtn) {
        self.clickBtn(self.model.path);
    }
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
